package com.fourth.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fourth.dao.ZoneBusinessDao;
import com.fourth.service.ZoneBusinessService;
import com.fourth.vo.ZoneBusinessVo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ljx.entity.ZoneBusiness;
import com.ljx.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author：lmy
 * @Date：2023/2/28 19:11
 */
@Service
public class ZoneBusinessServiceImpl extends ServiceImpl<ZoneBusinessDao, ZoneBusiness> implements ZoneBusinessService {

    @Autowired(required = false)
    private ZoneBusinessDao zoneBusinessDao;
    @Override
    public Result managementZone(Integer currentPage, Integer pageSize, ZoneBusinessVo zoneBusinessVo) {
        List<ZoneBusiness> zoneBusinessList = zoneBusinessDao.selectByZoneId(zoneBusinessVo);
        PageHelper.startPage(currentPage, pageSize);
        PageInfo<ZoneBusiness> pageInfo = new PageInfo<>(zoneBusinessList);
        if (zoneBusinessList != null ){
            return new Result(2000,"查询成功",pageInfo);
        }
        return new Result(2000,"查询失败");
    }

    @Override
    public Result selectBusiness(Integer currentPage, Integer pageSize, ZoneBusinessVo zoneBusinessVo) {
        List<ZoneBusiness> zoneBusinessList = zoneBusinessDao.selectStores(zoneBusinessVo);
        PageHelper.startPage(currentPage, pageSize);
        PageInfo<ZoneBusiness> pageInfo = new PageInfo<>(zoneBusinessList);
        if (zoneBusinessList != null ){
            return new Result(2000,"查询成功",pageInfo);
        }
        return new Result(2000,"查询失败");
    }
}
